package com.ecity.citybuilding.gps;

import java.io.Serializable;

import com.esri.core.geometry.Point;
public class GpsXYZ implements Serializable {

	private static final long serialVersionUID = 1L;

	public GpsXYZ(double x, double y) {
		this(x, y, 0);
	}

	public GpsXYZ(double x, double y, double z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}

	private double x = 0;

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	private double y = 0;

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}

	private double z = 0;

	public double getZ() {
		return z;
	}

	public void setZ(double z) {
		this.z = z;
	}

	@Override
	public String toString() {
		return x + "	" + y + "	" + z;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(x);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(y);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(z);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof GpsXYZ)) {
			return false;
		}
		GpsXYZ other = (GpsXYZ) obj;
		if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x)) {
			return false;
		}
		if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y)) {
			return false;
		}
		if (Double.doubleToLongBits(z) != Double.doubleToLongBits(other.z)) {
			return false;
		}
		return true;
	}

	public boolean IsUsefull() {
		return x > 0 && y > 0;
	}

	public Point convertToPoint() {
		return new Point(x, y);
	}
}
